import java.awt.Point;
import org.rsbot.script.methods.Calculations;
import org.rsbot.script.methods.Camera;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.Mouse;
import org.rsbot.script.methods.Players;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.util.Timer;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;

final class VoltrexApeAtoll$Antibans
{
  private static final int MOUSE_MOVE_RANDOMLY = 0;
  private static final int CAMERA_MOVE_SLIGHTLY = 1;
  private static final int SKILLS_HOVER_AGILITY = 2;
  private static final int TABS_SELECT_RANDOM = 3;
  private static final int HOVER_PLAYER = 4;
  private static final int ALL_ANTIBANS = 5;
  private int currentAntiban;
  private final Timer timer = new Timer(0L);
  private int counter;

  private VoltrexApeAtoll$Antibans(VoltrexApeAtoll paramVoltrexApeAtoll)
  {
  }

  private boolean perform(int[] paramArrayOfInt, int paramInt)
    throws IllegalArgumentException
  {
    if (this.currentAntiban == 0) {
      if (paramArrayOfInt == null) throw new IllegalArgumentException("The selection of antibans is null.");
      if (paramInt < 1) throw new IllegalArgumentException("The probability is below one: " + paramInt);

      if ((paramArrayOfInt.length == 0) || (this.this$0.random(0, paramInt) != 0)) {
        return false;
      }
      this.currentAntiban = ((paramArrayOfInt.length == 1) && (paramArrayOfInt[0] == 5) ? this.this$0.random(0, 5) : paramArrayOfInt[this.this$0.random(0, paramArrayOfInt.length)]);

      if ((0 > this.currentAntiban) || (this.currentAntiban >= 5))
        throw new IllegalArgumentException("Invalid antiban in selection: " + this.currentAntiban);
      this.timer.setEndIn(this.counter = 0);
    }

    int i = VoltrexApeAtoll.access$200(this.this$0).getSpeed();
    VoltrexApeAtoll.access$300(this.this$0).setSpeed(this.this$0.random(5, 10));

    switch (this.currentAntiban) {
    case 0:
      if (this.timer.isRunning()) break;
      this.timer.setEndIn(this.this$0.random(755, 2345));

      if (++this.counter < this.this$0.random(2, 5))
        VoltrexApeAtoll.access$600(this.this$0).move(this.this$0.random(5, VoltrexApeAtoll.access$400(this.this$0).getWidth() - 253), this.this$0.random(5, VoltrexApeAtoll.access$500(this.this$0).getHeight() - 169));
      else this.currentAntiban = 0;
      break;
    case 1:
      VoltrexApeAtoll.access$800(this.this$0).setAngle(VoltrexApeAtoll.access$700(this.this$0).getAngle() + this.this$0.random(-80, 80));
      this.currentAntiban = 0;
      break;
    case 2:
      if (this.timer.isRunning()) break;
      this.timer.setEndIn(this.this$0.random(755, 2345));
      if (this.counter == 0) {
        VoltrexApeAtoll.access$900(this.this$0).doHover(12);
        this.timer.setEndIn(this.this$0.random(1735, 2865));
        this.counter += 1; } else {
        this.currentAntiban = 0;
      }break;
    case 3:
      if (this.timer.isRunning()) break;
      this.timer.setEndIn(this.this$0.random(755, 2345));
      int[] tmp544_542 = new int[16]; VoltrexApeAtoll.access$1000(this.this$0); tmp544_542[0] = 1;
      int[] tmp556_544 = tmp544_542; VoltrexApeAtoll.access$1100(this.this$0); tmp556_544[1] = 0;
      int[] tmp568_556 = tmp556_544; VoltrexApeAtoll.access$1200(this.this$0); tmp568_556[2] = 11;
      int[] tmp581_568 = tmp568_556; VoltrexApeAtoll.access$1300(this.this$0); tmp581_568[3] = 13;
      int[] tmp594_581 = tmp581_568; VoltrexApeAtoll.access$1400(this.this$0); tmp594_581[4] = 5;
      int[] tmp606_594 = tmp594_581; VoltrexApeAtoll.access$1500(this.this$0); tmp606_594[5] = 9;
      int[] tmp619_606 = tmp606_594; VoltrexApeAtoll.access$1600(this.this$0); tmp619_606[6] = 10;
      int[] tmp633_619 = tmp619_606; VoltrexApeAtoll.access$1700(this.this$0); tmp633_619[7] = 4;
      int[] tmp646_633 = tmp633_619; VoltrexApeAtoll.access$1800(this.this$0); tmp646_633[8] = 7;
      int[] tmp660_646 = tmp646_633; VoltrexApeAtoll.access$1900(this.this$0); tmp660_646[9] = 14;
      int[] tmp674_660 = tmp660_646; VoltrexApeAtoll.access$2000(this.this$0); tmp674_660[10] = 15;
      int[] tmp688_674 = tmp674_660; VoltrexApeAtoll.access$2100(this.this$0); tmp688_674[11] = 12;
      int[] tmp702_688 = tmp688_674; VoltrexApeAtoll.access$2200(this.this$0); tmp702_688[12] = 6;
      int[] tmp716_702 = tmp702_688; VoltrexApeAtoll.access$2300(this.this$0); tmp716_702[13] = 3;
      int[] tmp729_716 = tmp716_702; VoltrexApeAtoll.access$2400(this.this$0); tmp729_716[14] = 2;
      int[] tmp742_729 = tmp729_716; VoltrexApeAtoll.access$2500(this.this$0); tmp742_729[15] = 8; int[] arrayOfInt = tmp742_729;

      VoltrexApeAtoll.access$2600(this.this$0).openTab(arrayOfInt[this.this$0.random(0, arrayOfInt.length)]);
      this.currentAntiban = 0;
      break;
    case 4:
      if (this.timer.isRunning()) break;
      this.timer.setEndIn(this.this$0.random(755, 2345));
      Object localObject = null;
      RSPlayer[] arrayOfRSPlayer = VoltrexApeAtoll.access$2700(this.this$0).getAll();

      localObject = arrayOfRSPlayer[this.this$0.random(0, arrayOfRSPlayer.length - 1)];
      if (localObject != null) { String str2;
        try { String str1 = localObject.getName();
          str2 = this.this$0.getMyPlayer().getName();
          if (str1.equals(str2))
            break;
        } catch (NullPointerException localNullPointerException)
        {
        }
        try {
          RSTile localRSTile = localObject.getLocation();
          str2 = localObject.getName();
          Point localPoint = VoltrexApeAtoll.access$2800(this.this$0).tileToScreen(localRSTile);
          if ((VoltrexApeAtoll.access$2900(this.this$0).pointOnScreen(localPoint)) && (localPoint != null)) {
            VoltrexApeAtoll.access$3000(this.this$0).click(localPoint, 5, 5, false);
            this.this$0.log("ANTIBAN - Hover Player - Right click on " + str2);
          } else {
            break;
          }
        } catch (Exception localException) {
        }
      } else {
        this.currentAntiban = 0;
      }break;
    default:
      throw new AssertionError("Unsupported antiban in selection: " + this.currentAntiban);
    }

    VoltrexApeAtoll.access$3100(this.this$0).setSpeed(i);
    return this.currentAntiban != 0;
  }
}